import { imgBaseUrl, baseURL } from './baseUrl'
// 图片渲染
export const getImgUrl = (image) =>{
    return imgBaseUrl+image;
}

// 获取是否展示
export const showInfoFunc = (info) => {
    const showInfo = uni.getStorageSync('showInfo')
	return showInfo.find(item => item.functionName == info)
}

// 图片上传
export const uploadImg = async (e,callback) => {
    const tempFilePaths = e.tempFilePaths;
    let  imgInfo = ''
    uni.showLoading({
        title: '上传中...'
    });
    uni.uploadFile({
        url: `${baseURL}/sys/common/upload`, //仅为示例，非真实的接口地址
        filePath: tempFilePaths[0],
        name: 'file',
        formData: {
            // 'biz': 'postPicture'
        },
        header: {
            "X-Access-Token": uni.getStorageSync("token")
        },
        success: (uploadFileRes) => {
            imgInfo = JSON.parse(uploadFileRes.data);
            console.log("imgInfo======>",imgInfo)
            uni.hideLoading();
            callback(imgInfo)
        }
    });
    console.log("imgInfo",imgInfo)
}